/* eslint-disable react-refresh/only-export-components */
import React from "react";
import { chepiaoApi } from "../../api/cpxx";
import {useSearchParams } from "react-router-dom";
import Mynav from "../../components/Mynav";
import Ticketlist from "./components/Ticketlist";
function Index() {
  const [sp] = useSearchParams();
  const start = sp.get("start");
  const end = sp.get("end");

  return (
    <div>
      <Mynav title={start + "-->" + end} />
      <Ticketlist/>
    </div>

    
  );
}

export default Index;
export const loader = async ({ request }) => {
  const url = new URL(request.url);
  const data = Object.fromEntries(url.searchParams);
  // console.log('data',data)
  const { data: res } = await chepiaoApi(data);
  // console.log(res);
  return { list: res };
};
